#include "head.h"
bool my_ls(sendMsg msg, client_status clients,int net_fd){
    printf("进入了ls的客户端\n");
    msg.mode=2;
    strcpy(msg.msg,clients.path_last);
    send(net_fd,&msg,sizeof(msg),0);
    char *last_token;
    recvMsg ret_msg;
    char result[1000]={0};
    bzero(&ret_msg,sizeof(ret_msg));
    recv(net_fd,&ret_msg,sizeof(ret_msg),0);
    if(strcmp(ret_msg.statu,"error")==0){
        printf("路径不正确!\n");
    }else{
        char *token=strtok(ret_msg.msg,"/"); 
        strcat(result, token);
        strcat(result, "  ");
        while(token!=NULL){
            last_token=token;
            token=strtok(NULL,"/");
            if(token){
                strcat(result, token);
            }
            strcat(result, "  ");
            //往标准输入返回结果
        }}
    printf("%s\n",result);
    return true;
}
